# Contributor: Natanael Copa <ncopa@alpinelinux.org>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=py3-parsing
_pkgname=pyparsing
pkgver=2.4.7
pkgrel=3
pkgdesc="An object-oriented approach to text processing"
url="https://github.com/pyparsing/pyparsing"
arch="noarch"
license="MIT"
depends="python3"
source="https://files.pythonhosted.org/packages/source/${_pkgname:0:1}/$_pkgname/$_pkgname-$pkgver.tar.gz"
builddir="$srcdir"/$_pkgname-$pkgver

replaces="py-parsing" # Backwards compatibility
provides="py-parsing=$pkgver-r$pkgrel" # Backwards compatibility

check() {
	python3 -m unittest
}

package() {
	# Can't use setuptools since setuptools depends on this
	local _site_pkgs="$(python3 -c 'import site; print(site.getsitepackages()[0])')"
	local _py3ver=$(python3 -c 'import sys; print("{}.{}".format(sys.version_info.major, sys.version_info.minor))')

	mkdir -p "$pkgdir/$_site_pkgs"

	cp -rv $_pkgname.egg-info \
		"$pkgdir/$_site_pkgs"/$_pkgname-$pkgver-py$_py3ver.egg-info
	cp -rv pyparsing.py "$pkgdir/$_site_pkgs"

	python3 -m compileall -f -q "$pkgdir/$_site_pkgs"/*.py
}

sha512sums="0b9f8f18907f65cb3af1b48ed57989e183f28d71646f2b2f820e772476f596ca15ee1a689f3042f18458206457f4683d10daa6e73dfd3ae82d5e4405882f9dd2  pyparsing-2.4.7.tar.gz"
